//
//  PushCell.m
//  UI_Project_A
//
//  Created by GH on 16/3/5.
//  Copyright © 2016年 GH. All rights reserved.
//

#import "PushCell.h"
#import <UIImageView+WebCache.h>
#import <DKNightVersion.h>

@interface PushCell ()
@property (nonatomic ,retain)UIImageView *imageOfpic;
@property (nonatomic ,retain)UILabel *labelTitle;



@end

@implementation PushCell


- (void)dealloc {
    [_labelTitle release];
    [_imageOfpic release];
    [super dealloc];


}


- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {



    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self createImage];
        [self createlabel];
    }

    return self;
}



- (void)passModelOfPushModel:(ModelOfPushVideo *)model {

    
    self.labelTitle.text = model.title;
    self.labelTitle.dk_textColorPicker = DKColorWithColors([UIColor blackColor], [UIColor whiteColor]);

    [self.imageOfpic sd_setImageWithURL:[NSURL URLWithString:model.cover]];

}




- (void)createImage {

    self.imageOfpic = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageOfpic];
    [self.imageOfpic release];



}



- (void)createlabel {

    self.labelTitle = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelTitle];
    [self.labelTitle release];




}


- (void)layoutSubviews {

    [super layoutSubviews];
    self.imageOfpic.frame = CGRectMake(10, 10, self.frame.size.width/3, self.frame.size.height - 20);
    self.labelTitle.frame = CGRectMake(self.frame.size.width /3 +20, 10, self.frame.size.width *2 /3 - 20, 50);
    self.labelTitle.numberOfLines = 0;

    self.imageOfpic.userInteractionEnabled = YES;
    self.labelTitle.userInteractionEnabled = YES;
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
